package com.firestone.dao.primary.area;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import com.firestone.bean.dto.area.AreaDTO;
import com.firestone.bean.entity.mysql.primary.ImArea;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author CAIYJ
 * @since 2018-04-19
 */
public interface ImAreaDao extends BaseMapper<ImArea> {

    @Select("<script>  "
            + "SELECT ia.create_time, ia.update_time, ia.id, ia.`name`, ia.is_delete, icm.real_name AS create_user, icmp.real_name AS update_user "
            + "FROM im_area AS ia"
            + "LEFT JOIN im_center_manager AS icm ON icm.id = ia.creator "
            + "LEFT JOIN im_center_manager AS icmp ON icmp.id = ia.reviser "
            + "<where> ${ew.sqlSegment} </where> </script> ")
    <T> List<AreaDTO> selectAreaList(Pagination pagination,
            @Param("ew") Wrapper<T> wrapper);
}
